<%@page import="com.example.meal_ordering_system.entity.ShoppingCart"%>
<%@ page language="java" import="java.util.*,java.text.*" pageEncoding="utf-8"%>
<%@ page import="com.example.meal_ordering_system.entity.Menus" %>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>- My Food Cart</title>
	<meta content="" name="keywords" />
	<meta content="" name="description" />
	<link href="${pageContext.request.contextPath}/public/qiantai/css/common.css" rel="stylesheet" type="text/css" />
	<link href="${pageContext.request.contextPath}/public/qiantai/css/skin.css" rel="stylesheet" type="text/css" />
	<link href="${pageContext.request.contextPath}/public/qiantai/css/cancelButton.css" rel="stylesheet" type="text/css" />
	<link href="${pageContext.request.contextPath}/public/qiantai/css/submitButton.css" rel="stylesheet" type="text/css" />
</head>
<body style='background:transparent'>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td align="left" valign="top">
			<jsp:include flush="false" page="top.jsp"/>
		</td>
	</tr>
	<tr>
		<td height="50px"></td>
	</tr>

	<tr>
		<td align="center" valign="top" height="420px">
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td align="left" valign="top">
						<div align="center">
							<table id="table2" class="line_table" style="width: 700px; margin: 0; padding: 0" cellSpacing="0" cellPadding="0">
								<tbody style="margin: 0; padding: 0">
								<tr>
									<td class="line_table" align="center" colspan="4">
										<span class="left_bt2">My Food Order List</span></td>
								</tr>
								<tr>
									<td class="line_table" align="center" width="40%"><span class="left_bt2">Dish Name</span></td>
									<td class="line_table" align="center" width="20%"><span class="left_bt2">Unit Price</span></td>
									<td class="line_table" align="center" width="20%"><span class="left_bt2">Quantity</span></td>
									<td class="line_table" align="center" width="20%"><span class="left_bt2">&nbsp;&nbsp;</span></td>
								</tr>
									<%
									float totalPrice = 0.0f;
									int totalQuantity = 0;
									List<ShoppingCart> shoppingCart = (List<ShoppingCart>) session.getAttribute("shoppingcart");
									if (shoppingCart != null) {
										for (int i = 0; i < shoppingCart.size(); i++) {
											ShoppingCart sc = shoppingCart.get(i);
											totalPrice += sc.getPrice() * sc.getSums();
											totalQuantity += sc.getSums();
								%>
								<tr>
									<td class="line_table" align="center" width="40%"><span class="left_txt"><%= sc.getName() %></span></td>
									<td class="line_table" align="center" width="20%"><span class="left_txt"><%= sc.getPrice() %></span></td>
									<td class="line_table" align="center" width="20%"><span class="left_txt"><%= sc.getSums() %></span></td>
									<td class="line_table" align="center" width="20%"><a href="/orders/order_shoppingcardel?del=<%= i %>">Cancel</a></td>
								</tr>
									<%
										}
									}
								%>

								<tr>
									<td class="line_table" align="center" colspan="4">
										<span class="left_bt2">Subtotal:</span>&nbsp;
										<span style="color:#ff0000;"><%= totalPrice %></span>&nbsp;
										<span class="left_bt2">yuan</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<span class="left_bt2">Total:</span>&nbsp;
										<span style="color:#ff0000;"><%= totalQuantity %></span>&nbsp;
										<span class="left_bt2">Items</span>
									</td>
								</tr>
								<tr>
									<td class="line_table" align="center" colspan="4" valign="center">
										<a href="/orders/order_addshoppingcartoOrder" class="submitButton">Submit</a>
										&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										<a href="/orders/order_addshoppingcartoOrder?remove=1" class="cancelButton">Cancel all</a>
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td height="10px">&nbsp;</td>
	</tr>
	<tr>
		<td height="50px" align="center" valign="middle">
			<jsp:include flush="false" page="copyright.jsp"/>
		</td>
	</tr>
</table>
</body>
</html>
